package bankteam.dao;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.SQLException;
import java.util.List;

import bankteam.interfaces.poderInterface;
import bankteam.modelo.GrupoBastanteo;
import bankteam.modelo.Poder;
import bankteam.util.ConexionBD;

public class poderDAO implements poderInterface{

	@Override
	public void registraPoder(Poder poder) throws Exception {
		String query = "INSERT INTO cliente(Des_Poder, Cod_Tipo_Servicio) VALUES (?,?)";
		Connection con = null;
		PreparedStatement stmt = null;
		try {
			
			con = ConexionBD.obtenerConexion();
			stmt = con.prepareStatement(query);
			stmt.setDouble(1, poder.getCodPoder());
			stmt.setString(2, poder.getDesPoder());
			
			int i = stmt.executeUpdate();
			
			if (i != 1) {
				throw new SQLException("No se pudo insertar");
			}
		} catch (SQLException e) {
			System.err.println(e.getMessage());
			System.out.println(e.getMessage());
		} 
		
	}



}
